-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: use CurveStableSwapMetaNG contract #893
Conversation
Hi @rndquu I started the review, and did a quick scan first to get understanding of the changes. Since the pull request is big, it will take me some time to process. I will check the new curve implementation docs and go through the changes again tomorrow morning with a fresh brain and provide my feedback. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
heavy refactor, looking clean, as far as I am concern, this new metapool fixes most of the issues that comes with recent findings on TWAP so it comes reloaded!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All right! I needed a strong coffee. I am approving from my side as well.
My main takeaways noted during the review:
-
TWAPOracleDollar3poolFacet
andIMetaPool
removed in favor ofICurveStableSwapMetaNG
-
MockMetaPool
is nowMockCurveStableSwapMetaNG
. -
twapOracleDollar3PoolFacetImplementation
is out, meaning one facet less to deploy. Curve metapool is now stored and fully managed inmanagerFacet
. -
Metapool layout is as before, Dollar token first (index 0), 3CRV token has index 1.
-
TWAP price for Dollar is now available as
ICurveStableSwapMetaNG(store.stableSwapMetaPoolAddress).price_oracle(0);
// get Dollar price from Curve Metapool (18 decimals) | ||
uint256 dollarPriceUsdD18 = LibTWAPOracle.getTwapPrice(); | ||
uint256 dollarPriceUsdD18 = ICurveStableSwapMetaNG( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pairing Dollar with the tripool will still cause this issue, even if the pool used is a StableSwapMetaNG and not the old curve pools.
Recommendation:
The best solution to achieve an actual peg to $1 would be to use Chainlink price feeds instead. or to pair Dollar with a different asset that is actually pegged to $1 rather than 3CRV, given that currently the pool price will tend to follow 3CRV's price, which currently trades at $1.03.
This PR removes our current TWAP implementation and refactors the code to use the latest curve's metapool implementation with TWAP built-in.
Resolves: